#include <iostream>
#include <stdio.h>

#include <iostream>
#include <vector>

class Solution {
private:
    std::vector<std::vector<int>> result;
    std::vector<int> path;
    void backtracking (std::vector<int>& nums,std::vector<bool>& used) {
        
        if (path.size() == nums.size()) {
            result.push_back(path);
            return;
        }
        for (int i = 0; i < nums.size(); i++) {
            if(used[i] == true){
                continue;
            }
            path.push_back(nums[i]);
            used[i] = true;
            backtracking(nums, used);
            used[i] = false;
            path.pop_back();
            
        }
    }

public:
    std::vector<std::vector<int>> subsets(std::vector<int> nums) {
        result.clear();
        path.clear();
        std::vector<bool> used(nums.size(), false);
        backtracking(nums, used);
        return result;
    }
};

int main(int argv, char**argc)
{

    printf("************  test hello zc!!!   **************\n");
    /* add test code! */
    Solution solve;
    std::vector<std::vector<int>> ret;
    std::vector<int> vec = {1, 2, 3};
    ret = solve.subsets(vec);
    printf("[ ");
    for(auto p:ret){
        printf("[");
        for(auto q:p){
            printf("%d ", q);
        }
        printf("] \n");    
    }
    printf("]\n");
    return 0;
}
